package com.wuda.sample;

import com.wuda.util.PriorityLinkedQueue;
import com.wuda.util.PriorityLinkedQueue.Order;

public class QueeuTest {
	
	/**
	 * 降序
	 */
	public void Desc(){
			PriorityLinkedQueue<Integer> ints = new PriorityLinkedQueue<Integer>(-1,Order.DESC);
			int[] nums = new int[] { 3, 2, 8, 0, 1, 5, 6, 9, 7, 6 };
			for (int i = 0; i < nums.length; i++) {
				ints.add(nums[i]);
			}
			Integer n = ints.next();
			while (n != null) {
				System.out.println(n);
				n = ints.next();
			}
	}
	
	/**
	 * 升序
	 */
	public void Asc(){
			PriorityLinkedQueue<String> ints = new PriorityLinkedQueue<String>(-1,Order.ASC);
			String[] strs = new String[] { "b", "e", "w", "z", "h", "a", "A", "v", "n", "t" };
			for (int i = 0; i < strs.length; i++) {
				ints.add(strs[i]);
			}
			String s = ints.next();
			while (s != null) {
				System.out.println(s);
				s = ints.next();
			}
	}


	/**
	 * @param args
	 */
	public static void main(String[] args) {
		QueeuTest test=new QueeuTest();
		System.out.println("------------降序-----------");
		test.Desc();
		System.out.println("------------升序-----------");
		test.Asc();
		

	}

}
